// pages/profile/profile.js
Page({
  data: {
    // 页面数据
  },

  onLoad: function(options) {
    // 页面加载时执行
  },

  onShow: function() {
    // 页面显示时执行
  },

  viewAllOrders: function() {
    wx.navigateTo({
      url: '/pages/order/list/list?type=all'
    });
  },

  navigateToOrderList: function(e) {
    const status = e.currentTarget.dataset.status;
    wx.navigateTo({
      url: `/pages/order/list/list?status=${status}`
    });
  },

  navigateToFavorites: function() {
    wx.navigateTo({
      url: '/pages/favorites/favorites'
    });
  },

  navigateToHistory: function() {
    wx.navigateTo({
      url: '/pages/history/history'
    });
  },

  navigateToAddress: function() {
    wx.navigateTo({
      url: '/pages/address/address'
    });
  },

  navigateToNotifications: function() {
    wx.navigateTo({
      url: '/pages/notifications/notifications'
    });
  },

  contactCustomerService: function() {
    wx.showModal({
      title: '联系客服',
      content: '客服电话: 400-123-4567',
      confirmText: '呼叫',
      success: function(res) {
        if (res.confirm) {
          wx.makePhoneCall({
            phoneNumber: '4001234567'
          });
        }
      }
    });
  },

  navigateToAbout: function() {
    wx.navigateTo({
      url: '/pages/about/about'
    });
  },

  switchTab: function(e) {
    const url = e.currentTarget.dataset.url;
    wx.switchTab({
      url: url
    });
  }
});